package com.demonzym.http.api;

import com.demonzym.activity.data.ItemInfoData;
import com.demonzym.activity.data.PlaylistInfoData;
import com.demonzym.framework.net.http.HttpRequest;
import com.demonzym.framework.net.http.HttpResponse;
import com.demonzym.framework.net.task.AbstractHttpTask;

public class GetItemInfoTask extends AbstractHttpTask {
	
	private String itemCodes;
	
	public GetItemInfoTask(String codes){
		itemCodes = codes;
	}
	
	@Override
	public HttpRequest buildHttpRequest() {
		HttpRequest hr = new HttpRequest(ConstUrl.TUDOU_API_HOST);
		hr.addHttpParams("method", "item.info.get");
		hr.addHttpParams("appKey", ConstUrl.TUDOU_APPKEY);
		hr.addHttpParams("format", "json");
		hr.addHttpParams("itemCodes", itemCodes);
		return hr;
	}

	@Override
	protected ItemInfoData[] buildResponseObject(HttpResponse hr) {
		return ItemInfoData.parseItem(new String(hr.data));
	}

	@Override
	protected int buildType() {
		return Api.GETITEM;
	}
}
